package com.gdkm.database.mapper;

import com.gdkm.database.domain.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author HD-0078 杨炜耀
 * @date 2021-5-7 09:24
 */
public interface UserMapper {

    @Insert("INSERT INTO user (name, password) VALUES (#{user.name}, #{user.password})")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    int insertUser(@Param("user") User user);

    @Select("select * from user")
    List<User> getUser();
}
